@extends('layouts.default') @section('main')
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/chosen.css" />
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a>
                <a href="{{url('user/index')}}" class="tip-bottom">会员管理</a>
                <a href="#" class="current">新增会员</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>新增会员-投资人</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('user/insert')}}" method="post" id="adForm" class="form-horizontal">
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>会员账号(username) :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="username" placeholder="会员账号" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>会员昵称 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="nickname" placeholder="会员昵称" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>真实姓名 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="realname" placeholder="真实姓名" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">会员头像 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="avatar"
                                               placeholder="点击右边小图标上传" />
                                        <img  src=""  width="120px" name="avatar" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadWxphotoBtn"   onclick="javascript:openBrowse('uploadWxphotoBtn','uploadWxphoto');">点击上传(图片大小不小于h:320像素×w:320像素)</a>
                                        <input type="file" id="uploadWxphoto" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadWxphoto','avatar')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>密码 :</label>
                                    <div class="controls">
                                        <input type="password" class="span11" name="password"
                                               placeholder="密码" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>确认密码 :</label>
                                    <div class="controls">
                                        <input type="password" class="span11" name="rePassword"
                                               placeholder="确认密码" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>性别 :</label>
                                    <div class="controls">
                                        <select  name="gender" class="span11" >
                                            <option value="">请选择会员性别</option>
                                            <option value="1">男</option>
                                            <option value="0">女</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>邮箱 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="email" placeholder="邮箱" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>关注的行业(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="关注的行业（多选）" class="chzn-select" name="followIndustry[]" multiple style="width:600px;" tabindex="4" id="dl_chose1">
                                            @foreach($lists as $list)
                                                <option value="{{$list->id}}">{{$list->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>所在地区 :</label>
                                    <div class="controls">
                                        <select name="province_id" id="city">
                                            <option value="">省份</option>
                                            @foreach($zoneTree as $zone)
                                                <option value="{{$zone['id']}}">{{$zone['name']}}</option>
                                            @endforeach
                                        </select>
                                        <select name="zone_id" id="zone">
                                            <option value="">城市</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">详细地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="address"  placeholder="会员地址" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="zipcode"  placeholder="邮编" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">上传个人名片 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="business_card"
                                               placeholder="点击右边小图标上传" />
                                        <img  src=""  width="120px" name="business_card" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadCardBtn"   onclick="javascript:openBrowse('uploadCardBtn','uploadCard');">点击上传</a>
                                        <input type="file" id="uploadCard" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadCard','business_card')"/>
                                    </div>
                                </div>

                                    <div class="widget-title">
                                        <span class="icon"> <i class="icon-align-justify"></i></span>
                                        <h5>投资信息</h5>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">个性签名 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="sign"  placeholder="个性签名" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>一句话简介 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="introduction"   placeholder="一句话简介" />
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>主投方向(多选) :</label>
                                        <div class="controls">
                                            <select data-placeholder="主投方向（多选）" class="chzn-select" name="investIndustry[]" multiple style="width:605px;" tabindex="4" id="dl_chose2">
                                                @foreach($lists as $list)
                                                    <option value="{{$list->id}}" >{{$list->name}}</option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>投资经历 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="investCase"    />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>投资机构名 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="institution_name"   placeholder="投资机构名" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>职务 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="job"   placeholder="投资人职务" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">电话 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="tel"   placeholder="电话" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">传真 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="fax"   placeholder="传真" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label"><span class="redD">*</span>机构地址 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="office_address"   placeholder="机构地址" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">机构邮编 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="office_zipcode"   placeholder="机构邮编" />
                                        </div>
                                    </div>

                                <div class="control-group">
                                    <label class="control-label">投资金额最小值(单位,万元) :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="fund_min"   placeholder="投资金额最小值(单位,万元)" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">投资金额最大值(单位,万元) :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="fund_max"   placeholder="投资金额最大值(单位,万元)" />
                                    </div>
                                </div>



                                <div class="control-group">
                                    <label class="control-label">投资轮次偏好(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="投资轮次偏好（多选）" class="chzn-select" name="invest_project_period[]" multiple style="width:605px;" tabindex="4" id="dl_chose1">
                                            @foreach($types as $k=>$v)
                                                <option value="{{$k}}" >{{$v}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="form-actions">
                                    <input type="hidden" class="span11" name="formType" id="formType" value="investCreate"  />
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">保存</button>
                                </div>
                            </form>
                            @include('errors.list')
                            @include('message.flash')
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        $(document).ready(function(){
            //初始化
            $(".chzn-select").chosen();

        });

        $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });
        $("#doSave").click(function(){
            $(this).attr('disabled','disabled');

            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    $("#doSave").removeAttr('disabled');

                    alert(data.message);
                }
            });
        });
    </script>
@stop
